﻿// <copyright file="GameSettings.cs" company="Marcin Wosik">
// Copyright (c) 2010 All Right Reserved
// </copyright>
// <author>Marcin Wosik</author>
// <email>mawo11@gmail.com</email>
// <date>2010-02-25</date>
// <summary></summary>
namespace GameOfLife.GameData
{
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    using GameOfLife.Assets.Resources;
    using GameOfLife.Interfaces;

    /// <summary>
    /// The class constains attributes for game "Game of life"
    /// </summary>
    public sealed class GameSettings
    {
        #region Properties

        /// <summary>
        /// 
        /// </summary>
        public BoardType BoardType
        {
            get; set;
        }

        public ColorMode ColoringMode
        {
            get; set;
        }

        /// <summary>
        /// Number of columns
        /// </summary>
        [Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(ApplicationStrings))]
        public int Columns
        {
            get; set;
        }

        /// <summary>
        /// Method of making connection beetwen celluar
        /// </summary>
        public ConnectionType ConnectionType
        {
            get; set;
        }

        /// <summary>
        /// Blocks of element wich contains celluar data 
        /// </summary>
        public IList<IElement> Elements
        {
            get; set;
        }

        /// <summary>
        /// Number of rows
        /// </summary>
        [Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(ApplicationStrings))]
        public int Rows
        {
            get; set;
        }

        /// <summary>
        /// Rule of game 
        /// </summary>
        [Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(ApplicationStrings))]
        public string Rule
        {
            get; set;
        }

        /// <summary>
        /// Frequency simulation
        /// </summary>
        public int TimerStep
        {
            get; set;
        }

        #endregion Properties

        #region Methods

        /// <summary>
        /// Creating new instance of lifedata class with default settings
        /// </summary>
        /// <returns>New instance of clas LifeData which default setting</returns>
        public static GameSettings Default()
        {
            GameSettings temp = new GameSettings();
            temp.Columns = 60;
            temp.Rows = 40;
            temp.Rule = "23/3";
            temp.BoardType = BoardType.Block; // for now only this is supported
            temp.TimerStep = 100; // half second
            temp.ConnectionType = ConnectionType.Moore;
            temp.ColoringMode = ColorMode.Default;
            return temp;
        }

        #endregion Methods
    }
}